import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/page/home'
  },
  {
    path: '/page',
    name: 'page',
    component: () => import('../views/page/index.vue'),
    children:[
      {
        path: '/page/home',
        name: 'home',
        component: () => import('../views/page/home.vue'),
      },
      {
        path: '/page/order',
        name: 'order',
        component: () => import('../views/page/order.vue'),
      },
      {
        path: '/page/customer',
        name: 'customer',
        component: () => import('../views/page/customer.vue'),
      },
      {
        path: '/page/my',
        name: 'my',
        component: () => import('../views/page/my.vue'),
      },
    ]
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search/index.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/detail/index.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/passenger',
    name: 'passenger',
    component: () => import('../views/passenger/index.vue')
  },
  {
    path: '/info',
    name: 'info',
    component: () => import('../views/info/index.vue')
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
